package com.wicket.okrapp.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrapp.biz.service.OfficialDocumentService;
import com.wicket.okrapp.biz.service.dto.req.*;
import com.wicket.okrapp.biz.service.dto.res.*;
import com.wicket.okrapp.common.ro.OkrResult;
import com.wicket.okrapp.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/app/officialDocument/")
public class OfficialDocumentController {

  @Autowired
  OfficialDocumentService officialDocumentService;
/**
   * D3修改公文
   */
    @PostMapping("updateOfficialDocument")
    public OkrResult<UpdateOfficialDocumentRespDto> updateOfficialDocument(@RequestBody @Validated UpdateOfficialDocumentReqDto reqDTO){
    return OkrResult.success(officialDocumentService.updateOfficialDocument(reqDTO));
    }
/**
   * D3-9删除公文(公共)
   */
    @PostMapping("deleteOfficialDocumentCom")
    public OkrResult<DeleteOfficialDocumentComRespDto> deleteOfficialDocumentCom(@RequestBody @Validated DeleteOfficialDocumentComReqDto reqDTO){
    return OkrResult.success(officialDocumentService.deleteOfficialDocumentCom(reqDTO));
    }
/**
   * D3-9查询公文详情(公共)
   */
    @PostMapping("queryOfficialDocumentDetailCom")
    public OkrResult<QueryOfficialDocumentDetailComRespDto> queryOfficialDocumentDetailCom(@RequestBody @Validated QueryOfficialDocumentDetailComReqDto reqDTO){
    return OkrResult.success(officialDocumentService.queryOfficialDocumentDetailCom(reqDTO));
    }
/**
   * D3-9查询相同公文列表(公共)
   */
    @PostMapping("queryAlikeOfficialDocumentListCom")
    public OkrResult<QueryAlikeOfficialDocumentListComRespDto> queryAlikeOfficialDocumentListCom(@RequestBody @Validated QueryAlikeOfficialDocumentListComReqDto reqDTO){
    return OkrResult.success(officialDocumentService.queryAlikeOfficialDocumentListCom(reqDTO));
    }
/**
   * D3-9新增公文主体(公共)
   */
    @PostMapping("addOfficialDocumentBodyCom")
    public OkrResult<AddOfficialDocumentBodyComRespDto> addOfficialDocumentBodyCom(@RequestBody @Validated AddOfficialDocumentBodyComReqDto reqDTO){
    return OkrResult.success(officialDocumentService.addOfficialDocumentBodyCom(reqDTO));
    }
/**
   * D3新增公文
   */
    @PostMapping("addOfficialDocument")
    public OkrResult<AddOfficialDocumentRespDto> addOfficialDocument(@RequestBody @Validated AddOfficialDocumentReqDto reqDTO){
    return OkrResult.success(officialDocumentService.addOfficialDocument(reqDTO));
    }
/**
   * D3-9修改公文主体(公共)
   */
    @PostMapping("updateOfficialDocumentBodyCom")
    public OkrResult<UpdateOfficialDocumentBodyComRespDto> updateOfficialDocumentBodyCom(@RequestBody @Validated UpdateOfficialDocumentBodyComReqDto reqDTO){
    return OkrResult.success(officialDocumentService.updateOfficialDocumentBodyCom(reqDTO));
    }
/**
   * D3查询公文列表
   */
    @PostMapping("queryOfficialDocumentList")
    public OkrResult<QueryOfficialDocumentListRespDto> queryOfficialDocumentList(@RequestBody @Validated QueryOfficialDocumentListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryOfficialDocumentListRespDto retData = officialDocumentService.queryOfficialDocumentList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);

    }
/**
   * D3删除公文
   */
    @PostMapping("deleteOfficialDocument")
    public OkrResult<DeleteOfficialDocumentRespDto> deleteOfficialDocument(@RequestBody @Validated DeleteOfficialDocumentReqDto reqDTO){
    return OkrResult.success(officialDocumentService.deleteOfficialDocument(reqDTO));
    }
/**
   * D3查我接收的公文列表
   */
    @PostMapping("queryMyReceiveOfficialDocumentList")
    public OkrResult<QueryMyReceiveOfficialDocumentListRespDto> queryMyReceiveOfficialDocumentList(@RequestBody @Validated QueryMyReceiveOfficialDocumentListReqDto reqDTO){
    return OkrResult.success(officialDocumentService.queryMyReceiveOfficialDocumentList(reqDTO));
    }
/**
   * D3查询公文详情
   */
    @PostMapping("queryOfficialDocumentDetail")
    public OkrResult<QueryOfficialDocumentDetailRespDto> queryOfficialDocumentDetail(@RequestBody @Validated QueryOfficialDocumentDetailReqDto reqDTO){
    return OkrResult.success(officialDocumentService.queryOfficialDocumentDetail(reqDTO));
    }
/**
   * D3查接收的公文列表
   */
    @PostMapping("queryReceiveOfficialDocumentList")
    public OkrResult<QueryReceiveOfficialDocumentListRespDto> queryReceiveOfficialDocumentList(@RequestBody @Validated QueryReceiveOfficialDocumentListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryReceiveOfficialDocumentListRespDto retData = officialDocumentService.queryReceiveOfficialDocumentList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }
/**
   * D3执行回写公文安排的任务(公共)
   */
    @PostMapping("implementWriteBackOffcialDocArrangeTaskCom")
    public OkrResult<ImplementWriteBackOffcialDocArrangeTaskComRespDto> implementWriteBackOffcialDocArrangeTaskCom(@RequestBody @Validated ImplementWriteBackOffcialDocArrangeTaskComReqDto reqDTO){
    return OkrResult.success(officialDocumentService.implementWriteBackOffcialDocArrangeTaskCom(reqDTO));
    }
/**
   * D3查询未安排的公文列表
   */
    @PostMapping("queryUnscheduledOfficialDocList")
    public OkrResult<QueryUnscheduledOfficialDocListRespDto> queryUnscheduledOfficialDocList(@RequestBody @Validated QueryUnscheduledOfficialDocListReqDto reqDTO){
    return OkrResult.success(officialDocumentService.queryUnscheduledOfficialDocList(reqDTO));
    }
/**
   * D3查询公文主体列表(公共)
   */
    @PostMapping("queryOfficialDocumentBodyListCom")
    public OkrResult<QueryOfficialDocumentBodyListComRespDto> queryOfficialDocumentBodyListCom(@RequestBody @Validated QueryOfficialDocumentBodyListComReqDto reqDTO){
    return OkrResult.success(officialDocumentService.queryOfficialDocumentBodyListCom(reqDTO));
    }
/**
   * D3执行通知类型消息模板分析(公共)
   */
    @PostMapping("implementNotificationTypeMsgTempanAlyzeCom")
    public OkrResult<ImplementNotificationTypeMsgTempanAlyzeComRespDto> implementNotificationTypeMsgTempanAlyzeCom(@RequestBody @Validated ImplementNotificationTypeMsgTempanAlyzeComReqDto reqDTO){
    return OkrResult.success(officialDocumentService.implementNotificationTypeMsgTempanAlyzeCom(reqDTO));
    }
/**
   * D3分析通知类型行为类型(公共)
   */
    @PostMapping("analysisNotificationTypeBehaviorTypeCom")
    public OkrResult<AnalysisNotificationTypeBehaviorTypeComRespDto> analysisNotificationTypeBehaviorTypeCom(@RequestBody @Validated AnalysisNotificationTypeBehaviorTypeComReqDto reqDTO){
    return OkrResult.success(officialDocumentService.analysisNotificationTypeBehaviorTypeCom(reqDTO));
    }
}
